/*
    指针常量和常量指针
*/
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    int a = 1;
    int b = 3;
    // 左定值右定向
    // 指针常量
    int * const p1 = &a;
    cout << a << endl;
    cout << p1 << endl;
    *p1 = 100;
    cout << a << endl;
    cout << p1 << endl;

    cout << endl;

    // 常量指针
    const int *p2 = &b;
    cout << p2 << endl;
    p2 = &a;
    cout << p2 << endl;

    // 双重const引用，指针的指向和指向的值都不可以改变
    const int* const p3 = &a;

    return 0;
}
